Skip to content

fix: resolve path traversal, cache integrity, and HTTP parsing vulnerabilities#16

Merged
justinmerrell merged 1 commit intomainfrom
fix/security-integrity-audit
Mar 30, 2026
Merged

fix: resolve path traversal, cache integrity, and HTTP parsing vulnerabilities#16
justinmerrell merged 1 commit intomainfrom
fix/security-integrity-audit

Conversation

@justinmerrell
Copy link
Copy Markdown
Contributor

Summary

  • Path traversal (security): Reject .. and absolute paths in skill export methods (export_path, export_zip, export_openai_inline_skill) to prevent directory escape. Defense-in-depth added in _place_skill_file().
  • Cache poisoning: Always compute actual SHA256 before caching — never store under an unverified claimed hash, preventing poisoning via verify_checksums=False.
  • Cache-hit verification: Re-hash cached blobs when verify_checksums=True on the cache-hit fast path.
  • Manifest completeness: Raise IntegrityError when pull response is missing layers from the resolve manifest.
  • Retry-After parsing (RFC 9110): Handle both delay-seconds and HTTP-date formats; gracefully degrade to None on unparseable values.
  • CACHEDIR.TAG: Reset _tag_written flag in cache_clear() so the tag is recreated on subsequent writes.
  • Docs/API cleanup: Fix runtime path docs for macOS/Windows, remove unreachable VersionNotFoundError from public API, clarify cache_remove/cache_clean comments.

Test plan

  • Path traversal: 4 new tests — .. segments and absolute paths rejected in all export methods
  • Cache-hit integrity: covered by existing + new cache tests
  • Retry-After: 3 new tests — numeric, HTTP-date, and invalid header formats
  • CACHEDIR.TAG: 1 new test — clear then write recreates tag
  • All 227 tests pass, all checks (format, lint, types) pass, 95% coverage

🤖 Generated with Claude Code

…abilities

- Reject `..` and absolute paths in skill export to prevent directory escape
- Always hash content before caching to prevent cache poisoning via verify_checksums=False
- Re-verify cached blob checksums on cache-hit pulls
- Enforce manifest completeness — raise on missing layers in pull response
- Parse Retry-After as both delay-seconds and HTTP-date (RFC 9110)
- Reset _tag_written flag in cache_clear() so CACHEDIR.TAG is recreated
- Fix runtime path docs for macOS/Windows to match code
- Remove unreachable VersionNotFoundError from public API
- Clarify cache_remove/cache_clean comments in README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justinmerrell justinmerrell merged commit 9f46c24 into main Mar 30, 2026
6 checks passed
@justinmerrell justinmerrell deleted the fix/security-integrity-audit branch March 30, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant